package com.jwt.boot.config;

import com.jwt.boot.interceptors.JWTInterceptors;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @date 2020/10/4 14:43
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
//        添加拦截器
        registry.addInterceptor(new JWTInterceptors())
//                设置拦截的路径
                .addPathPatterns("/**")
                .excludePathPatterns("/login");
    }
}
